package vg.modules.attribute_panel.components.data;


/**
 * This class realizes row of attribute table.
 * @author tzolotuhin
 */
public class AttributeRow {
	private String name; // name of attribute
	private final AttributeShower shower; // show attribute or unshow
	private String type; // type of attribute (vertex(V) or edge(E))
	private AttributeValue value; // list of attribute values 
	/**
	 * Constructor.
	 * @param name - name of attribute.
	 * @param shower - attribute shower 
	 * @param type - type of attribute(V or E)
	 * @param value - values of attribute.
	 */
	public AttributeRow(String name, AttributeShower shower, String type, AttributeValue value) {
		this.name = name;
		this.shower = shower;
		this.type = type;
		this.value = value;
	}
	public AttributeRow(String name, boolean show, String type, AttributeValue value) {
		this.name = name;
		if(show) {
			this.shower = new AttributeShower(AttributeShower.DEF_SHOW_GREEN);
		} else {
			this.shower = new AttributeShower(AttributeShower.DEF_UNSHOW_GREEN);
		}
		this.type = type;
		this.value = value;
	}
	/**
	 * Default constructor.
	 * name = ""
	 * show = 0
	 * values = empty
	 * type = ?
	 */
	public AttributeRow() {
		this.name = new String("");
		this.shower = new AttributeShower(AttributeShower.DEF_UNSHOW_GREEN);
		this.value = new AttributeValue();
		this.type = new String("?");
	}
	//-------------------------------------------------------------------------
	public void setName(String name) {
		this.name = name;
	}
	public void setType(String type) {
		this.type = type;
	}
	public void setValues(AttributeValue value) {
		this.value = value;
	}
	public boolean addValue(String value) {
		return(this.value.addValue(value));
	}
	//-------------------------------------------------------------------------
	public String getName() {
		return(this.name);
	}
	public AttributeShower getShower() {
		return(this.shower);
	}
	public final int getShow() {
		return(this.shower.getShow());
	}
	
	public String getType() {
		return(this.type);
	}
	public AttributeValue getValue() {
		return(this.value);
	}
}
